<template>
  <!--   高薪职位模块      -->
  <view class="all-container">
    <view class="content-box">
      <view class="text-title space-between">
        <view style="display: flex; align-items: center">
          <view class="title-flag"></view><text>高薪职位</text>
        </view>
        <view class="more-pos" @click="onClickMore"
          ><span class="style-text-more-job">更多</span>
          <img class="style-image-more-job" :src="arrowRight" />
        </view>
      </view>
       

      <view
        class="position-card"
        v-for="(item, index) in list"
        :key="index"
        @click="onClickItem(item)"
      >
        <view class="card-title">
          <view class="style-text-title">{{ item.position }}</view>
          <view class="salary">{{ item.monthlyPay }}</view>
        </view>
        <view class="card-desc">
          <view class="desc-item"
            ><img :src="srcEducation" /><text>{{
              item.education || "不限"
            }}</text></view
          >
          <view class="desc-item"
            ><img :src="srcExperience" /><text>{{ item.workNum || "不限" }}</text
            ><img
              :src="srcLocation"
              style="margin-left: 40rpx"
              v-if="item.address != ''"
          /></view>
          <view class="f1">{{ item.address }}</view>
        </view>
      </view>
    </view>
  </view>
</template>
   
    <script>
export default {
  mixins: [],
  components: {},
  props: {
    info: {
      type: Object,
      default: function () {
        return {
          list: undefined,
          positionId: undefined,
          layerId: undefined,
        };
      },
    },
  },
  data() {
    return {
      srcEducation:
        this.$imgBaseSelf +
        "career/positionDictionary/job_detail_recommend_job_education.png",
      srcExperience:
        this.$imgBaseSelf +
        "career/positionDictionary/job_detail_recommend_job_experience.png",
      srcLocation:
        this.$imgBaseSelf +
        "career/positionDictionary/job_detail_recommend_job_location.png",
      arrowRight:
        this.$imgBaseSelf + "career/positionDictionary/job_detail_more_job.png",
      personId: uni.getStorageSync("person-id").slice(2) || "",
      realLayerId: "",
      realPositionId: "",
      positionName:undefined,
      list: [
        // {
        //   position: "机床设计师",
        //   address: "上海市-浦东区",
        //   monthlyPay: "1-2万",
        // },
      ],
    };
  },
  mounted() {},

  created() {},

  onLoad(opt) {},

  watch: {
    info: {
      handler(val) {
        if (val && val.list && Array.isArray(val.list)) {
          var tempList = [];
          for (var i = 0; i < val.list.length; i++) {
            //   position: "机床设计师",
            //   address: "上海市-浦东区",
            //   monthlyPay: "1-2万",
            var item = val.list[i];
            tempList.push({
              position: item.dataName,
              address: item.address,
              monthlyPay: item.salary,
              dataId: item.dataId,
              education:item.education,
              workNum:item.workNum,
            });
          }
          this.list = tempList;
        }
        if (val && val.layerId) {
          this.realLayerId = val.layerId;
        }
        if (val && val.positionId) {
          this.realPositionId = val.positionId;
        }
        if(val && val.positionName){
          this.positionName = val.positionName; 
        }
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    onClickItem(item) {
      uni.navigateTo({
        url:
          "/pagesSub/public/jobDetail/index?jobId=" +
          item.dataId +
          "&positionId=" +
          this.realPositionId,
      });
    },

    onClickMore() {
      // uni.navigateTo({
      //   url:
      //     "/pagesSub/career/morePositions/index?positionId=" +
      //     this.realPositionId,
      // });

      uni.navigateTo({ url: "/pagesSub/index/search/index?jobName="+this.positionName });
    },
  },
};
</script>
    
    <style lang="scss" scoped>
.space-between {
  justify-content: space-between;
}
.text-title {
  display: flex;
  align-items: center;
  font-size: 32rpx;
  font-family: PingFang-SC-Heavy, PingFang-SC;
  font-weight: 800;
  color: #222222;
  line-height: 44rpx;
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-right: 30rpx;
  margin-top: 30rpx;
  margin-bottom: 10rpx;

  .title-flag {
    width: 8rpx;
    height: 36rpx;
    border-radius: 64rpx;
    background-color: #f75a3e;
    margin-right: 16rpx;
  }
  .more-pos {
    display: flex;
    flex-direction: row;
    align-items: center;

    .style-text-more-job {
      color: #999999;
      font-size: 24rpx;
      font-weight: 300;
    }

    .style-image-more-job {
      width: 24rpx;
      height: 24rpx;
    }
  }
}

.all-container {
  background: #efefef;
  display: flex;
  flex-direction: column;

  width: 100vw;

  .content-box {
    background: #ffffff;
    margin-left: 15rpx;
    margin-right: 15rpx;
    margin-bottom: 15rpx;
    margin-top: 15rpx;
    padding-left: 30rpx;
    border-radius: 25rpx;

    .position-item {
      display: flex;
      flex-direction: row;
      //align-items: center;
      padding-top: 20rpx;
      font-size: 30rpx;
      padding-bottom: 20rpx;
      .address {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
      }
      .monthly-pay {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        color: #e16156;
      }
    }

    .position-card {
      //padding: 32rpx 0;
      padding-top: 32rpx;
      padding-bottom: 32rpx;
      margin-right: 30rpx; 
      border-radius: 30rpx;

      & ~ .position-card {
        border-top: 2rpx solid #f4f4f4;
       // padding-bottom: 0;
      }

      .card-title {
        font-size: 36rpx;
        font-family: PingFang-SC-Bold, PingFang-SC;
        font-weight: bold;
        color: #222222;
        display: flex;
        justify-content: space-between;

        .style-text-title {
          flex: 1;
          width: 0;
          max-height: 400rpx;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
        }

        .salary {
          font-size: 32rpx;
          font-family: PingFangSC-Semibold, PingFang SC;
          font-weight: 600;
          color: #f75a3e;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
        }
      }

      .card-desc {
        display: flex;
        font-size: 24rpx;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #555555;
        white-space: nowrap;
        margin-top: 10rpx;

        img {
          width: 24rpx;
          height: 24rpx;
          margin-right: 6rpx;
          left: 0;
        }

        .desc-item {
          display: flex;
          align-items: center;
        }

        .desc-item ~ .desc-item {
          margin-left: 40rpx;
        }

        .f1 {
          flex: 1;
          min-width: 0;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }

      .tips {
        display: flex;
        flex-wrap: wrap;
        margin-top: 20rpx;

        .tipsItem {
          font-size: 26rpx;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #555555;
          padding: 6rpx 12rpx 8rpx 12rpx;
          background: #f7f7f9;
          border-radius: 8rpx;
          margin-right: 16rpx;
          overflow: hidden;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
          // margin-top: 20rpx;
        }
      }

      .address {
        display: flex;
        margin-top: 30rpx;
        justify-content: space-between;
        align-items: center;
        font-size: 26rpx;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999999;

        .addressLeft {
          display: flex;
          align-items: center;

          text {
            max-width: 300rpx;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-left: 30rpx;
          }

          img {
            width: 70rpx;
            height: 41.5rpx;
            border-radius: 10rpx;
            border: 1rpx solid #d9d9d9;
          }
        }
      }
    }
  }
}
</style>